// Tests using serial port + XBee to communicate between cubes

#include <iostream>
#include <wiringSerial.h>
#include <string>
#define BAUD_RATE 115200 
#define SER_PORT "/dev/ttyUSB0"

int main(int argc, char ** argv)
{
	std::string buffer;//[256];// = new char[256];
	int fd = serialOpen(SER_PORT, BAUD_RATE); 
	if(fd >= 0){
		while(1){
			//serialPutchar(fd, 'a'); 
			std::getline(std::cin, buffer);
			std::cout << std::endl << buffer << std::endl; 
			serialPuts(fd, buffer.c_str());
			//serialPutchar(fd, '\0');  
		}
	}else{
		std::cout << "Error Opening USB" << std::endl; 	
	}
	
	
	return 0; 
}
